/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//		File Name		:		CPayer.h
//
//		Author			:		Kevin Jordan
//
//		Purpose			:		Encapsulate all functionality in the Player class
//
//		Dates			:		Written( Feb 15, 2011 ) by Kevin Jordan		LastUpdate( Feb 15, 2011  ) by Kevin Jordan 
//	
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef PLAYER_H_
#define PLAYER_H_

#include "CBaseObject.h"
#include <windows.h>
#include <vector>
using std::vector;
#include <stdio.h>
#include "tinyxml/tinyxml.h"
#include "CAnimation.h"
typedef int skill;

class CPlayer : public CBaseObject
{

private:

	skill m_skDurability;
	skill m_skCombat;
	skill m_skSpeed;
	int m_nRage;
	bool m_bRagin;
	bool m_bObjHeld;
	bool m_bJumped;
	bool m_bDoubleJump;
	float m_fOrigin;
	float bucket;
	float charge;
	float chargeTime;
	float flickbucket;
	float m_nHealth;
	IBaseInterface* HeldObject;

	bool flip;
	bool Charging;
	bool DuraPowered;
	bool ComabtPowered;
	bool SpeedPowered;
	bool RagePowered;
	bool flicker;

	bool leftpunch;
	bool rightpunch;

	int m_nCash;
	// How much Rage he currently has
	float m_nRageAmount;
	int PlayerState;
	int m_nLives;

	unsigned int Collection;

	vector<CAnimation> vAnimation;
	int CurAnimation;	

	
	float m_fRageTime;
	float m_fDuraTime;
	float m_fCombatTime;
	float m_fSpeedTime;
	void OnEnter(int newState);

	float CombatModifier;
	float SpeedModifier;
	float RageModifier;
	float DurabilityModifier;

public:

	CPlayer();
	~CPlayer();
	void Render();
	bool Input();
	void Update( float fElapsedTime);
	
	//void PickUp(Item* Item);
	void Drop();
	void Throw(IBaseInterface* ThrownObj);

	///////////////////////////////////////////////////////
	///////////////////////////////////////////////////////
	//Accessors & Mutators
	///////////////////////////////////////////////////////
	///////////////////////////////////////////////////////
	// Accessors
	///////////////////////////////////////////////////////
	skill GetDurability()	{ return m_skDurability;	 }
	skill GetCombat()		{ return m_skCombat;}
	skill GetSpeed()		{ return m_skSpeed; }
	int GetRage()			{ return m_nRage;}
	float GetRageAmt()		{ return m_nRageAmount;}
	int GetCash()			{ return m_nCash; }
	int GetLives()			{ return m_nLives;}
	unsigned int GetCollection()	{return Collection;}

	bool IsDurable()		{ return  DuraPowered; }
	bool IsDeadly()			{ return  ComabtPowered; }
	bool IsFast()			{ return SpeedPowered; }
	bool IsPissed()			{ return m_bRagin; }
	float GetMaxHealth() {return m_nHealth;}

	///////////////////////////////////////////////////////
	///////////////////////////////////////////////////////
	//	Mutators
	///////////////////////////////////////////////////////
	void SetCash( int newCash )			{ m_nCash = newCash; }
	void SetCombat( int newCombat )		{ m_skCombat = newCombat; }
	void SetSpeed( int newSpeed )			{ m_skSpeed = newSpeed; }
	void SetDurability( int newDura )		{ m_skDurability = newDura;}
	void SetRage( int newRage )			{ m_nRage = newRage; }
	void SetRageAmnt(float NewRageAmt)	
	{
		m_nRageAmount = NewRageAmt;
		if(m_nRageAmount < 0) {m_nRageAmount = 0;}
		else if(m_nRageAmount > 100){m_nRageAmount = 100;} 
	}
	void SetMaxHealth(float NewMaxHealth) {m_nHealth = NewMaxHealth;}
	void SetLives(int NewLife)				{m_nLives = NewLife;}
	void ResetPlayer();


	void Durable(bool newDuraStatus)		{ DuraPowered = newDuraStatus; }
	void Deadly(bool newComabtStatus)		{ ComabtPowered = newComabtStatus; }
	void Fast(bool newFastStatus)			{ SpeedPowered = newFastStatus; }
	void Pissed(bool newPissedStatus)		{ RagePowered = newPissedStatus; }

	void Jumpy(){m_bJumped = m_bDoubleJump = false;}

	bool CheckCollision( IBaseInterface* pBase );

	//Increments the Collection by one
	void IncCollection()					{ Collection++;}

	//Decrements the Collection by one
	void DecCollection()					{ Collection--;}
	//bool CheckCollision( CBaseObject* pBase );

	bool Load( const char* AnimInfo);

	
	void ChangeState(int newState);

	void SetCurAnimation(int setCur)
	{
		CurAnimation = setCur;
		/*if(vAnimation[CurAnimation].Playing())
			vAnimation[CurAnimation].Stop();*/
		//vAnimation[CurAnimation].Play();
	}

	RECT GetAttackRect();
	RECT GetHealthRect();


};
#endif